package com.rqian.spring.profile.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rqian.spring.profile.bean.LoginUser;
import com.rqian.spring.profile.bean.UserProfileBean;
import com.rqian.spring.profile.mapper.UserProfileMapper;
import com.rqian.spring.profile.service.LoadUserDataService;

/**
 * 
 * load user profile by login email and login password.
 * 
 * @author: rqian
 * @version: 1.0, Apr 26, 2012
 */
@Service
public class LoadUserDataServiceImpl implements LoadUserDataService {

	@Autowired
	private UserProfileMapper	userProfileDao;



	@Override
	public UserProfileBean loadUserProfileWithLoginUserData(LoginUser user) {
		String email = user.getEmail();
		String passwdMD5 = user.getPasswordWithMD5();

		UserProfileBean userProfile = userProfileDao.queryUserProfileByLoginData(email, passwdMD5);
		if (userProfile != null) {
			return userProfile;
		}
		return null;
	}

}
